function beta=getbeta(alpha)

K=size(alpha,2);
old=(0:alpha(K))';
for ii=K-1:-1:1
    new=(0:alpha(ii))';
    tmp1=ones(size(new));
    tmp2=ones(size(old,1),1);
    oldleft=kron(tmp1,old);
    newright=kron(new,tmp2);
    old=unique([newright,oldleft],'rows');
end
beta=old;
    